package com.hueydink.rhythmrouletteserver;

public class MessageUtil {

	public static String makeIdentificationMsg(int playerId) {
		String identificationMsg = "";
		String playerIdString = "";
		String s1 = "<identification><playerid>";
		String s2 = "</playerid></identification>";

		if (playerId == 1) {
			playerIdString = "1";
		}
		if (playerId == 2) {
			playerIdString = "2";
		}
		if (playerId == 3) {
			playerIdString = "3";
		}

		identificationMsg = s1 + playerIdString + s2;
		System.out.println("playerId == " + playerId);
		return identificationMsg;
	}

	public static String makeUpdateMsg(int round, int pitcher, int p1Result,
			int p2Result, int p3Result) {
		String updateMsg;

		String s1 = "<update><roundnumber>";
		String s2 = "</roundnumber><pitcher>";
		String s3 = "</pitcher><player1result>";
		String s4 = "</player1result><player2result>";
		String s5 = "</player2result><player3result>";
		String s6 = "</player3result></update>";

		updateMsg = s1 + round + s2 + pitcher + s3 + p1Result + s4 + p2Result
				+ s5 + p3Result + s6;

		return updateMsg;
	}

	public static String makeErrorMsg(int errorCode) {
		String errorMsg;
		String s1 = "<error><errorcode>";
		String s2 = "</errorcode></error>";

		errorMsg = s1 + errorCode + s2;

		return errorMsg;
	}

}